<template>
<!-- 注册审核 -->
<el-container class="registcheck">
    <el-header style="text-align: right; font-size: 12px">
        <div class="merchant">
            <nuxt-link to="shopUser">供应商</nuxt-link>
            <nuxt-link to="purchaseUser">采购商</nuxt-link>
        </div>
    </el-header>
    <el-main>
        <nuxt-child></nuxt-child>
    </el-main>
</el-container>
</template>

<style lang="scss" scoped>
.registcheck {
    .nuxt-link-active {
        display: inline-block;
        width: 88px;
        height: 29px;
        line-height: 29px;
        border-radius: 29px;
        text-align: center;
        background: #1f8cfc;
        color: #fff;
    }
    .el-header {
        height: auto !important;
        padding: 30px 134px 30px 0px;
        font-size: 16px !important;
        border-bottom:1px solid #eee;
        .merchant {
            a {
                &:hover {
                    cursor: pointer;
                }
                &:first-child {
                    margin-right: 54px;
                }
            }
        }
    }
    & /deep/ {
        .el-main {
            padding-right: 0 !important;
        }
    }
}
</style>

<script>
import {mapMutations} from 'vuex'
import {getUserMenuTree} from '~/api/'
export default {
    data() {
        return {
            merchant_type: 'supply', //supply表示供应商，pay表示采购商
        }
    },
    methods: {
      ...mapMutations(['SET_MENU'])
    },
    async created() {
      const {isLogin, menu} = this.store.state
      if (isLogin&&menu.length==0) {
        const res = await getUserMenuTree(this)
        if (res.code == '0') {
          this.SET_MENU(res.data.menu)
        }
      }
    },
    beforeMount() {
        this.$router.replace('/registcheck/shopUser')
    }
}
</script>
